//
//  MHCopyTest.m
//  JadeShop
//
//  Created by mac on 2019/7/18.
//  Copyright © 2019年 SZJ.test. All rights reserved.
//

#import "MHCopyTest.h"

@implementation MHCopyTest

- (instancetype)init
{
    self = [super init];
    if (self) {
        
        NSMutableArray *mutableArray = NSMutableArray.array;
        [mutableArray addObject:NSMutableArray.array];
        
        NSLog(@"🍎 可变数组 %ld",(NSInteger)mutableArray);
        NSLog(@"🍎 可变数组里边的元素 %ld",(NSInteger)mutableArray[0]);
        
        NSLog(@"-------------拷贝--------------");
        
        
        NSMutableArray *mutableArrayCopy = mutableArray.copy;
        NSLog(@"🍎 可变数组拷贝 %ld  Class is %@",(NSInteger)mutableArrayCopy,mutableArrayCopy.class);
//        NSLog(@"🍎 可变数组拷贝里边的元素 %ld Class is %@",(NSInteger)mutableArrayCopy[0],[mutableArrayCopy[0] class]);
        
        NSMutableArray *mutableArrayMutableCopy = mutableArray.mutableCopy;
        NSLog(@"🍎 可变数组可变拷贝 %ld Class is %@",(NSInteger)mutableArrayMutableCopy,mutableArrayMutableCopy.class);
//        NSLog(@"🍎 可变数组可变拷贝里边的元素 %ld Class is %@",(NSInteger)mutableArrayMutableCopy[0],[mutableArrayMutableCopy[0] class]);
        
        NSLog(@"-------------初始化--------------");
        
        NSArray *initMutableArray = [NSArray arrayWithArray:mutableArray];
        NSLog(@"🍎 初始化数组 %ld Class is %@",(NSInteger)initMutableArray,initMutableArray.class);
//        NSLog(@"🍎 初始化数组里边的元素 %ld Class is %@",(NSInteger)initArray[0],[initArray[0] class]);
        
        NSMutableArray *initMutableMutableArray = [NSMutableArray arrayWithArray:mutableArray];
        NSLog(@"🍎 初始化数组 %ld Class is %@",(NSInteger)initMutableMutableArray,initMutableMutableArray.class);
//        NSLog(@"🍎 初始化数组里边的元素 %ld Class is %@",(NSInteger)initMutableArray[0],[initMutableArray[0] class]);
        
        NSLog(@"-------------不可变数组-------------");
        
        NSArray *array = [NSArray arrayWithObject:@[]];

        NSLog(@"🍎 不可变数组 %ld",(NSInteger)array);
        NSLog(@"🍎 不可变数组里边的元素 %ld",(NSInteger)array[0]);
        
        NSLog(@"-------------拷贝--------------");
        
        
        NSMutableArray *arrayCopy = array.copy;
        NSLog(@"🍎 不可变数组拷贝 %ld  Class is %@",(NSInteger)arrayCopy,arrayCopy.class);
        NSLog(@"🍎 可变数组拷贝里边的元素 %ld Class is %@",(NSInteger)arrayCopy[0],[arrayCopy[0] class]);
        
        NSMutableArray *arrayMutableCopy = array.mutableCopy;
        NSLog(@"🍎 不可变数组可变拷贝 %ld Class is %@",(NSInteger)arrayMutableCopy,arrayMutableCopy.class);
        NSLog(@"🍎 可变数组可变拷贝里边的元素 %ld Class is %@",(NSInteger)arrayMutableCopy[0],[arrayMutableCopy[0] class]);
        
        NSLog(@"-------------初始化--------------");
        
        NSArray *initArray = [NSArray arrayWithArray:array];
        NSLog(@"🍎 初始化数组 %ld Class is %@",(NSInteger)initArray,initArray.class);
        NSLog(@"🍎 初始化数组里边的元素 %ld Class is %@",(NSInteger)initArray[0],[initArray[0] class]);
        
        NSMutableArray *initMutableArrayArray = [NSMutableArray arrayWithArray:array];
        NSLog(@"🍎 初始化数组 %ld Class is %@",(NSInteger)initMutableArrayArray,initMutableArrayArray.class);
        NSLog(@"🍎 初始化数组里边的元素 %ld Class is %@",(NSInteger)initMutableArrayArray[0],[initMutableArrayArray[0] class]);
        
    }
    return self;
}

@end
